import 'dart:async';

import 'package:flutter/services.dart';

class IosKit {
  static const MethodChannel _channel = const MethodChannel('ios_kit');

  static Future<String?> get platformVersion async {
    final String? version = await _channel.invokeMethod('getPlatformVersion');
    return version;
  }

  /// 是否是iOS 14
  static Future<bool?> get ios14 async {
    final String? ios14 = await _channel.invokeMethod('isIOS14');
    return ios14 != null && ios14 == "true" ? true : false;
  }

  /// 打开设置
  static Future<String?> get openSetting async {
    final String? openSetting = await _channel.invokeMethod('openSetting');
    return openSetting;
  }

  /// 查看权限状态 for iOS14
  static Future<String?> get checkStatus async {
    final String? status = await _channel.invokeMethod('checkStatus');
    return status;
  }
}
